﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace FeatureModelTool.Windows
{
    /// <summary>
    /// Interaction logic for EditType.xaml
    /// </summary>
    public partial class EditTypeDialog : Window
    {
        public Enum RType { get; protected set; }
        public bool Dirty { get; protected set; }
        public EditTypeDialog(Array types, Enum curValue)
        {
            InitializeComponent();
            this.Dirty = false;
            foreach (Enum t in types)
            {
                this.typeComboBox.Items.Add(t);
            }
            this.typeComboBox.SelectedItem = curValue;
        }

        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            if (typeComboBox.SelectedItem == null)
            {
                this.Close();
                return;
            }
            RType = (Enum)typeComboBox.SelectedItem;
            this.Dirty = true;
            this.Close();
        }
    }
}
